<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@ include file="/taglibs.jsp"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath()%>'/>
<script type="text/javascript" charset="UTF-8" src="${midContextPath}/js/jquery.alphanumeric.js"></script>
<s:url value="/js" var="jsPath"/>
<s:url value="/css" var="cssPath"/>
<s:url value="/images" var="imgPath"/>
<link rel="stylesheet" type="text/css" href="${cssPath}/smoothness.datepick.css" />
<script type="text/javascript" charset="UTF-8" src="${jsPath}/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="${jsPath}/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" href="<%=ServerValue.getMidContextPath()%>/css/jquery.tooltip.css" />
<script src="<%=ServerValue.getMidContextPath()%>/js/jquery.tooltip.js" type="text/javascript"></script>
<script language="javascript">
	$().ready(function(){
		$("tr[id*='tdDesc_']").tooltip();
		$("#createDateParam").datepick({showOn:'both',numberOfMonths:2, buttonImageOnly: true, buttonImage: '${imgPath}/calendar.gif',dateFormat:"yy-mm-dd"});
		$("#productIdParam").numeric();
		$("#searchbtn").click(function(){
			$("#productSearchForm").submit();
		});
	});
</script>
<h1>团购上架审核管理 - 查询</h1>

<s:if test="hasActionErrors()">
	<s:actionerror cssClass="msg rn"/>
</s:if>
<s:if test="hasActionMessages()">
	<s:actionmessage cssClass="msg rn"/>
</s:if>
<s:if test="hasFieldErrors()">
	<s:fielderror cssClass="msg rn"/>
</s:if>
<br />

<div class="data-form">
	<s:form action="searchTuangouApprove.do" method="post" id="productSearchForm">
		<b>商品编号：</b>
		<input name="productIdParam" id="productIdParam" type="text" title="商品编号" size="10" value="${productIdParam}" />
	  <b>申请人：</b>
  	<s:select name="createUserParam" list="tuangouUsers" listKey="username"  listValue="nameNative" headerKey="" headerValue="全部"/>
		<b>申请状态：</b>
		<s:select name="statusParam" list="shelfTuangouStatusMenu.options" listKey="key"  listValue="value.name"/>
	  <b>活动起始日期：</b>
  	<input name="createDateParam" id="createDateParam" size="10" maxlength="10" value="${createDateParam}" />
  	  <br /><b>商品名称：</b>
		<input name="productNameParam" id="productNameParam" type="text" title="商品名称" size="30" value="${productNameParam}" /><br />
		<input type="button" id="searchbtn" value="查询"/>	
	</s:form>
</div>
<br/>注：背景红色=活动结束
<table class="tb-1" width="100%">
	<thead>
		<tr>
			<th>申请日期</th>
			<th width="10%">商品编号&名称</th>
			<th width="15%">促销小标</th>
			<th>成本</th>
			<th>售价</th>
			<th>活动最低订购人数</th>
			<th>订购数量</th>
			<th>活动日期</th>
			<th>申请人</th>
			<th>审核人</th>
			<th>审核时间</th>
			<th>状态</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<c-rt:choose>
			<c-rt:when test="${not empty tuangouShelfs}">
				<c-rt:forEach items="${tuangouShelfs}" var="tuangouShelf" varStatus="index">
					<c-rt:set var="isTimeout" value="isTimeout${tuangouShelf.tuangouId}" />
					<c-rt:set var="pId" value="${tuangouShelf.productId}" />
					<tr class="${productMap[isTimeout] == 'true' ? 'bg-rd' : ''}" id="tdDesc_${index.count}" title="建立者:${tuangouShelf.createUser} 建立日期:${tuangouShelf.createDate}<br/>修改者:${tuangouShelf.modifyUser} 修改日期:${tuangouShelf.modifyDate}">
						<td><fmt-rt:formatDate value="${tuangouShelf.createDate}" pattern="yyyy-MM-dd"/></td>
						<td>${pId}&nbsp;&nbsp;&nbsp;${productMap[pId].productName}</td>
						<td>
							${fn:length(tuangouShelf.promoteName)>20 ? fn:substring(tuangouShelf.promoteName,0,20) : tuangouShelf.promoteName}${fn:length(tuangouShelf.promoteName)>20 ? '...' : ''}
						</td>
						<td><fmt-rt:formatNumber value="${productMap[pId].productCost}" pattern="######.00"/></td>
						<td><fmt-rt:formatNumber value="${tuangouShelf.price}" pattern="#####0.0#"/></td>
						<td>${tuangouShelf.lowestOrderQty}</td>
						<td>${tuangouShelf.orderQty}(订购) - ${tuangouShelf.cancelQty}(取消) = ${tuangouShelf.orderQty-tuangouShelf.cancelQty}(实际订购)</td>
						<td>
							起：<fmt-rt:formatDate value="${tuangouShelf.startDate}" pattern="yyyy-MM-dd HH:mm" /><br />
							迄：<fmt-rt:formatDate value="${tuangouShelf.endDate}" pattern="yyyy-MM-dd HH:mm" />
						</td>
						<td>${tuangouShelf.createUser}</td>
						<td>${tuangouShelf.approveUser}</td>
						<td><fmt-rt:formatDate value="${tuangouShelf.approveDate}" pattern="yyyy-MM-dd"/></td>
						<td>${shelfTuangouStatusMenu.options[tuangouShelf.status].name}</td>
						<td>
							<a href="${midContextPath}/shelf2/tuangouView.do?tuangouId=${tuangouShelf.tuangouId}">查询</a><br/>
							<c-rt:if test="${tuangouShelf.status eq 'SHF000'}">
								<yaodian100:checkPermission permissions="OTHER_TUANGOUMANAGER">
									<a href="${midContextPath}/shelf2/editTuangou.do?tuangouId=${tuangouShelf.tuangouId}&productId=${tuangouShelf.productId}&approveTuangou=Y">审核</a>
								</yaodian100:checkPermission>
							</c-rt:if>
						</td>
					</tr>
				</c-rt:forEach>
			</c-rt:when>
			<c-rt:otherwise>
				<tr>
					<td colspan="12">查无商品资料</td>
				</tr>
			</c-rt:otherwise>
		</c-rt:choose>
	</tbody>
</table>
<yaodian100:pageutil link="searchTuangouApprove.do" pagerObj="${pager}" />